cmake_minimum_required(VERSION 3.10)
project(RemezExecutable)

# 设置C++标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(${CMAKE_SOURCE_DIR}/include)

# 根据CMAKE_BUILD_TYPE设置C编译器的标志
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
endif()

# 添加可执行文件
add_executable(remez_exp
    src/exp_utils.cpp
    src/remez_utils.cpp
    src/use_remez_get_exp_coeffs_v1.cpp
    src/use_remez_get_exp_coeffs_v2.cpp
    src/use_remez_get_exp_coeffs_v3.cpp
    src/use_remez_get_exp_coeffs_v4.cpp
    src/use_remez_get_exp_coeffs_v5.cpp
    src/remez_exp_main.cpp
)

# 链接m库到remez_executable目标
target_link_libraries(remez_exp mpfr gmp)


# 添加可执行文件
add_executable(remez_log
    # src/exp_utils.cpp
    src/log_utils.cpp
    src/remez_utils.cpp
    src/use_remez_get_log_coeffs_v3.cpp
    src/use_remez_get_log_coeffs_v4.cpp
    src/remez_log_main.cpp
)
# 链接m库到remez_executable目标
target_link_libraries(remez_log mpfr gmp)

# 添加可执行文件
add_executable(remez_reciprocal
    src/remez_utils.cpp
    src/reciprocal_utils.cpp
    src/use_remez_get_reciprocal_coeffs_v1.cpp
    src/use_remez_get_reciprocal_coeffs_v2.cpp
    src/use_remez_get_reciprocal_coeffs_v3.cpp
    src/remez_reciprocal_main.cpp
)
# 链接m库到remez_executable目标
target_link_libraries(remez_reciprocal mpfr gmp)


# 添加可执行文件
add_executable(remez_invsqrt
    src/remez_utils.cpp
    src/invsqrt_utils.cpp
    src/use_remez_get_invsqrt_coeffs_v1.cpp
    src/use_remez_get_invsqrt_coeffs_v2.cpp
    src/use_remez_get_invsqrt_coeffs_v3.cpp
    src/remez_invsqrt_main.cpp
)
# 链接m库到remez_executable目标
target_link_libraries(remez_invsqrt mpfr gmp)
